package com.woniu.controller;

import com.woniu.dto.UserDto;
import com.woniu.service.UserService;
import com.woniu.utils.ResData;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {
    @Resource
    UserService userService;

    @RequestMapping("/findByUsername")
    public UserDto findByUsername(String username) {
        return userService.findByUsername(username);
    }

    @RequestMapping("/test1")
    public ResData test1() {
        return ResData.success("我是登录才能访问的资源");
    }

    @RequestMapping("/test2")
    public ResData test2() {
        return ResData.success("我是需要权限才能访问的资源");
    }

    @RequestMapping("/test3")
    public ResData test3() {
        return ResData.success("我是不用登录就能访问的资源");
    }
}
